// Copyright (c) 2016, yuxinyong and contributors
// For license information, please see license.txt
/* eslint-disable */

frappe.query_reports["Stock Requirements List"] = {
	"filters": [
		{
			"fieldname": "company",
			"label": __("Company"),
			"fieldtype": "Link",
			"reqd": 1,
			"width": "50",
			"only_select":1,
			"options": "Company",
			default: frappe.defaults.get_user_default("Company")
		},
		{
			"fieldname":"warehouse",
			"label": __("Warehouse"),
			"width": "50",	
			"fieldtype": "MultiSelectList",
			get_data: function(txt) {
				return frappe.db.get_link_options('Warehouse', txt,{
					'disabled': 0,
					'mrp_exclude': 0,
					'is_group': 0,
					company: frappe.query_report.get_filter_value("company")
				});
			}				
		},
		{
			"fieldname":"mrp",
			"label": __("MRP Run ID"),
			"width": "80",	
			"fieldtype": "Link",
			"options": "Multi Level MRP",
			"only_select":1				
		},
		{
			"fieldname":"planner",
			"label": __("Planner"),
			"fieldtype": "Link",			
            "options":"Planner",
			"only_select":1,
			"width": "50",	
		},
		{
			"fieldname":"item_group",
			"label": __("Item Group"),
			"fieldtype": "Link",			
            "options":"Item Group",
			"only_select":1,
			"width": "50",	
		},
		{
			"fieldname":"item_code",
			"label": __("Material"),
			"fieldtype": "Link",
			//"depends_on":"plant",
			//"reqd": 1,
			"only_select":1,
            "options":"Item",
			"width": "80",			
		},
		{
			"fieldname": "summary_level",
			"label": __("Summary Level"),
			"fieldtype": "Select",
			"options":['','Day','Week','Month','Overall Total'],
			"width": "50",						
		},
		{
			"fieldname": "only_negative_ending",
			"label": __("Only Negative End Availability"),
			"fieldtype": "Check",
			"width": "50",						
		}								
	],
	"formatter": function(value, row, column, data, default_formatter) {
		value = default_formatter(value, row, column, data);
		// show draft doc as red
		if (column.fieldname == "process_doctype" && data && data.docstatus ===  0) {
			value = `<div style="color:red">${value}</div>`;
		}
		return value;
	},
};
